package com.zgw.his.emr.widget;

import org.eclipse.e4.xwt.forms.medicalControl.IMedicalControl;
import org.eclipse.e4.xwt.forms.medicalControl.MButton;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;

import com.zgw.his.emr.model.DetailRecord;

public class MedicalDetail extends MedicalWidget {
	private Control control;
	private DetailRecord record;
	private IMedicalControl medicalControl;

	public MedicalDetail(DetailRecord record) {
		this.record = record;
		this.code = record.getCode();
	}

	public void initControl(IMedicalControl c) {
		this.medicalControl = c;
		if (record.getValue() != null) {
			c.setValue(record.getValue());
		} else if (record.getText() != null) {
			c.setValue(record.getText());
		}
		this.control = c.getControl();
	}

	// 刷新记录
	public void refresh_record() {
		if (control != null && !control.isDisposed()) {
			record.setText(medicalControl.getText());
		}
	}

	@Override
	public void setActivate(boolean activate) {
		// TODO 记录控件激活 与 休眠

	}

	public void createControl(Composite parent) {
		// TODO 创建记录控件
	}

	public void dispose() {
		// TODO 注销记录控件
	}

	public Control getControl() {
		return control;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public DetailRecord getRecord() {
		return record;
	}

	public void setRecord(DetailRecord record) {
		this.record = record;
	}

}
